package cn.tedu.spring.scope;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestOrders {
    public static void main(String[] args) {
        //创建容器对象
        ApplicationContext context=new AnnotationConfigApplicationContext("cn.tedu.spring.scope");
        //第一次获取对象
        Orders orders1 = context.getBean(Orders.class);
        System.out.println(orders1);
        //第二次获取对象
        Orders orders2 = context.getBean(Orders.class);
        System.out.println(orders2);
        //判断第一次和第二次获取的Orders对象是否是同一个对象
        boolean singleton=(orders1==orders2);
        System.out.println("容器里是否只有一个实例对象："+singleton);

    }
}
